﻿using Shumei.Common;
using Shumei.EFCore.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using System.Web;
namespace Shumei.EFCore.SimpleService
{
    /// <summary>
    /// 数据层 以及简单的逻辑
    /// </summary>
    public class UserService : BaseSimpleDAL<User>
    {
        public UserService()
        {
            
        }
        
        public User Find(string account)
        {
            return Entities.Find(account);
        }
        public async Task<User> FindAsync(string account)
        {
            return await Entities.FindAsync(account);
        }

        public async Task<bool> LoginCheck(string account, string password)
        {
            var res = await FindAsync(account);
            if(res != null)
            {
                string pwd = SimpleUtil.MD5Encrypt(password);
                if(pwd.Equals(res.password))
                {
                    return true;
                }
            }
            return false;
        }


    }
}
